package com.situ.day5.oop;

//Cannot inherit from final 'com.situ.day5.oop.Person'
public class Student extends Person {

    private String className;

    public Student() {

    }

    //Java里面new子类对象时候一定先把父类对象new出来
    public Student(String className) {
        super();// new Person()
        this.className = className;
    }

    public Student(int id, String name, int age, String className) {
        super(id, name, age);// new Person(id, name, age)
        this.className = className;
    }

    @Override
    public void show() {
        System.out.println("Student.show");
    }

    public void study() {
        System.out.println("id是"+id+"的"+name+"正在"+className+"学习");
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    @Override
    public String toString() {
        return "Student{" +
                "className='" + className + '\'' +
                "} " + super.toString();
    }
}
